<?php   
$time=date("Y-m-d-H");
$data = $GLOBALS['HTTP_RAW_POST_DATA']; 
$path = $time."/".$_GET[path]."\.txt"; 
if($data==""){return;}

$pathcopy=$path;
$new = array();

$token = strtok($pathcopy, "/");
array_push($new,$token);
while ($token !== false)
{
  $token = strtok("/");

  array_push($new,$token);

  $folder="";

  for($i=0;$i<count($new)-2;$i++){

     $folder = $folder.$new[$i]."/";

  }

 // if(count($new)==1)$folder = $folder.$new[0];
  
  mkdir($folder, 0777);

}

//if(!file_exists($path)){         
$fo = fopen($path,"w"); 
if(!fwrite($fo,$data)){ 
//echo $path." upload failed!" ;               
return "No";         
}else{  
//echo $path." upload success!";               
return "Yes";         
} 
//} 

echo $time.":".$_GET[path];

function getfolder(){
//�򿪼�¼txt
$txtpath="config.txt";
$fo = fopen($txtpath,"r");
$path = fread($fo, filesize ($txtpath));
fclose($fo);

//��ȡ�ļ����ļ�����
$i=0;
if ($handle = opendir($path)) {      
    /* ������ȷ�ر���Ŀ¼���� */   
    while (false !== ($file = readdir($handle))) {  
        if(($file !== "." ) && ($file != "..")){
          $i++ ;
        }
    }    
    closedir($handle);    
}  

//����1000�����½�һ������дconfig.txt
if($i>999){

   $path = date("YmdHis");
   mkdir($path, 0777); 
   $fo = fopen($txtpath,"w");
   fwrite($fo, $path);
   fclose($fo);
  
}
 return $path;
}

?>   
